import os
import shutil

def delete_file(file_path):
    try:
        if os.path.isdir(file_path):
            shutil.rmtree(file_path)
        else:
            os.remove(file_path)
        return {'success': True, 'message': 'File or directory deleted successfully.'}
    except Exception as e:
        return {'success': False, 'message': str(e)}